﻿#include "MainWindow.h"
#include "ui_MainWindow.h"

#include "AlarmHistoryView.h"

#include <QDebug>
#include <QTimer>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    setWindowTitle(QStringLiteral("告警信息滚动轮播控件 Qt小罗"));

    m_pView = new AlarmHistoryView(this);
    setCentralWidget(m_pView);

    QTimer::singleShot(1000, this, [=]() {
        for (int i = 0; i < 10; i++)
        {
            m_pView->addAlarmText(WarningLevel::Danger, QStringLiteral("Qt小罗提示，危险警告。。。。"));
        }
        for (int i = 0; i < 5; i++)
        {
            m_pView->addAlarmText(WarningLevel::Normal, QStringLiteral("Qt小罗提示，一般警告。。。。"));
        }
        for (int i = 0; i < 10; i++)
        {
            m_pView->addAlarmText(WarningLevel::Serious, QStringLiteral("Qt小罗提示，严重警告。。。。"));
        }
    });
}

MainWindow::~MainWindow()
{
    delete ui;
}

